<section class="content-header" >
    <h1>
        资金流水
        <small>会员资金流水列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="{:U('/Admin/index')}"><i class="fa fa-home"></i>首页</a></li>
        <li class="active">会员资金流水管理</li>
    </ol>
</section>
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <div class="box-title"><label >会员资金流水列表</label></div>
                    <div class="pull-right">
                    </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                    <table id="table" class="table table-bordered table-striped" width="100%">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>手机号</th>
                                <th>昵称</th>
                                <th>消费项目</th>
                                <th>消费</th>
                                <th>时间</th>
                            </tr>
                        </thead>
                    </table>
                </div><!-- /.box-body -->
            </div><!-- /.box -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</section><!-- /.content -->
<!-- DATA TABES SCRIPT -->
<!-- page script -->
<script type="text/javascript">
    $(function () {
        $('#table').dataTable({
            "searching": false,
            "ordering": false,
            "processing": true, //载入数据的时候是否显示“载入中”
//            ordering: false, //排序操作在服务端进行，所以可以关了。
            'serverSide': true,
            "ajax": "{:U('member/pagerFundList')}",
            "columns": [
                {"data": "id"},
                {"data": "mobile"},
                {"data": "member"},
                {"data": "servicename"},
                {"data": "totalprice"},
                {"data": "usetime"}
            ],
            "columnDefs": [
                {
                    "targets": 2,
                    "render": function (data, type, row) {
                        return data+"&nbsp;&nbsp;("+row.nickname+")";
                    }
                },
                {
                    "targets": 4,
                    "render": function (data, type, row) {
                        var html = "订单金额:"+data+"元&nbsp;&nbsp;";
                        if(row.type==-1){
                            return html+"(微信支付:"+row.use+"元)";
                        }
                        if(row.type==0){
                            return html+"(洗衣卡消费:"+row.use+"张)";
                        }
                        if(row.type==1){
                            return html+"(奢侈品护理卡消费:"+row.use+"元)";
                        }
                    }
                },
                {
                    "render": function (data, type, row) {
                        var day = new Date(data * 1000);
//                        day.setTime(data*1000);
                        return (day.getYear() + 1900) + "/" + (day.getMonth() + 1) + "/" + day.getDate();
                    },
                    "targets": 5
                }
            ],
            "language": lang
        });
    });


    function deleteItem(id) {
        $.messager.confirm('确认删除', '确认要删除会员？', function () {
            $.ajax({
                url: "{:U('member/deleteData')}",
                data: "id=" + id,
                success: function (json) {
                    if (!json.status) {
                        dialog({
                            "title": '提示信息',
                            "width": '20em',
                            'content': json.info
                        }).show();
                    } else {
                        dialog({
                            "title": '提示信息',
                            "width": '20em',
                            'content': json.info
                        }).show();
                    }
                    reloadContent();
                }
            });
        });

    }

</script>